// Copyright 2000-2021 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package com.linqingying.gitcode.pullrequest.data.service

import com.intellij.openapi.Disposable
import com.intellij.util.concurrency.annotations.RequiresEdt
import git4idea.GitRemoteBranch
import git4idea.remote.GitRemoteUrlCoordinates
import com.linqingying.gitcode.api.GCRepositoryCoordinates
import com.linqingying.gitcode.api.data.GCLabel
import com.linqingying.gitcode.api.data.GCUser
import com.linqingying.gitcode.api.data.pullrequest.GCPullRequestRequestedReviewer
import com.linqingying.gitcode.api.data.pullrequest.GCTeam
import com.linqingying.gitcode.util.GCGitRepositoryMapping
import java.util.concurrent.CompletableFuture

interface GCPRRepositoryDataService : Disposable {
  val remoteCoordinates: GitRemoteUrlCoordinates
  val repositoryCoordinates: GCRepositoryCoordinates
  val repositoryMapping: GCGitRepositoryMapping
    get() = GCGitRepositoryMapping(repositoryCoordinates, remoteCoordinates)

  val repositoryId: String
  val defaultBranchName: String?
  val isFork: Boolean

  val collaborators: CompletableFuture<List<GCUser>>
  val teams: CompletableFuture<List<GCTeam>>
  val potentialReviewers: CompletableFuture<List<GCPullRequestRequestedReviewer>>
  val issuesAssignees: CompletableFuture<List<GCUser>>
  val labels: CompletableFuture<List<GCLabel>>

  @RequiresEdt
  fun resetData()

  fun getDefaultRemoteBranch(): GitRemoteBranch?
}
